package net.wofly.sale.exchange.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import net.wofly.sale.exchange.repository.ExchangeStockRepository;
import net.wofly.sale.exchange.domain.ExchangeStock;
import net.wofly.sale.exchange.service.IExchangeStockService;

@Service("iExchangeStockService")
@Transactional
public class ExchangeStockServiceImpl implements IExchangeStockService {

	@Autowired
	ExchangeStockRepository exchangeStockRepository;

	@Override
	public ExchangeStock save(ExchangeStock entity) {
		return exchangeStockRepository.save(entity);
	}

	@Override
	public void delete(ExchangeStock entity) {
		exchangeStockRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		exchangeStockRepository.delete(key);
	}

	@Override
	public ExchangeStock findOne(String key) {
		return exchangeStockRepository.findOne(key);
	}

	@Override
	public List<ExchangeStock> save(List<ExchangeStock> entityList) {
		return (List<ExchangeStock>) exchangeStockRepository.save(entityList);
	}

	@Override
	public Page<ExchangeStock> findAll(Specification specification, Pageable pageable) {
		return exchangeStockRepository.findAll(specification, pageable);
	}

	@Override
	public Page<ExchangeStock> findAll(Pageable pageable) {
		return exchangeStockRepository.findAll(pageable);
	}
}
